###### Local configuration:

CUDA_INSTALL_PATH = /usr/local/cuda

CPU_ARCH = x86_32  # x86 or x86_64
GPU_ARCH = sm_20   # sm_10, sm_11, sm_12, sm_13, or sm_20

######

INC = -I$(CUDA_INSTALL_PATH)/include

ifeq ($(strip $(CPU_ARCH)), x86_64)
  LIB = -L$(CUDA_INSTALL_PATH)/lib64 -lcudart
  COPT =
  LDOPT =
else
  LIB = -L$(CUDA_INSTALL_PATH)/lib -lcudart
  COPT = -malign-double -m32
  NVCCOPT = -m32
  LDOPT = -m32
endif

COPT += -D__CUDA_ARCH__=$(GPU_ARCH:sm_%=%0)
NVCCOPT += -D__CUDA_ARCH__=$(GPU_ARCH:sm_%=%0)

ifeq ($(strip $(GPU_ARCH)), sm_20)
  NVCCOPT += -ftz=true -prec-div=false -prec-sqrt=false
endif

CC = gcc
CFLAGS = -g -Wall -O2 -std=c99 $(COPT) $(INC) -fopenmp
CXX = g++
CXXFLAGS = -g -Wall -O2 $(COPT) $(INC) -fopenmp
NVCC = $(CUDA_INSTALL_PATH)/bin/nvcc 
NVCCFLAGS = -O2 $(NVCCOPT) -arch=$(GPU_ARCH) $(INC) --ptxas-options=-v -Xptxas -abi=no -Xcompiler -fopenmp
LDFLAGS = -fPIC $(LIB) $(LDOPT) -lgomp
